﻿<%@ Page Language="C#" MasterPageFile="~/admin/adminMasterPage.master" AutoEventWireup="true" CodeFile="products.aspx.cs" Inherits="admin_product_products" Title="无标题页" %>
<asp:Content ID="Content2" ContentPlaceHolderID="contentPlaceHolder" Runat="Server">
     <div class="table">
        <div class="tableHead">
        全部产品
            <div style="display:inline;float:right;line-height:35px;vertical-align:middle;padding-top:5px;padding-right:5px;">
                <asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="True" 
                    AutoPostBack="True" DataSourceID="ObjectDataSource3" 
                    DataTextField="categoryName_cn" DataValueField="categoryId" 
                    onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                    <asp:ListItem Value="-1">全部类型</asp:ListItem>
    </asp:DropDownList>
                <asp:ObjectDataSource ID="ObjectDataSource3" runat="server" 
                    SelectMethod="getSmallCategory" TypeName="DB"></asp:ObjectDataSource>
            </div>
        </div>
    <asp:GridView ID="allProductGridView" runat="server" AutoGenerateColumns="False" 
        DataSourceID="ObjectDataSource1" Width="898px" 
        onrowcommand="GridView1_RowCommand" 
        >
        <Columns>
            <asp:TemplateField HeaderText="编号">
                <ItemTemplate>
                    <asp:Label ID="Label1" Text="<%#Container.DataItemIndex + 1%>" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="productName_cn" HeaderText="中文名" />
            <asp:BoundField DataField="productName_en" HeaderText="英文名" />
            <asp:BoundField DataField="categoryName_cn" HeaderText="所属分类" />
            <asp:TemplateField HeaderText="操作" ItemStyle-CssClass="op">
                <ItemTemplate>
                    <asp:Button ID="deleteButton" runat="server"
                        CommandName="deleteProduct" 
                        CommandArgument='<%#Eval("productId") %>'
                        Text="删除"
                        CssClass="button"
                        BorderColor="Transparent"
                        BorderStyle="None"
                       />
                    <asp:Button ID="editButton" runat="server"
                        CommandName="editProduct" 
                        CommandArgument='<%#Eval("productId") %>'
                        Text="编辑"
                        CssClass="button"
                        BorderColor="Transparent"
                        BorderStyle="None"
                       />      
                </ItemTemplate>
            </asp:TemplateField> 
        </Columns>
    </asp:GridView>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        SelectMethod="getAllProducts" TypeName="DB"></asp:ObjectDataSource>
    </div>
</asp:Content>

